package com.tongji.showroom.utils
{	
	import com.tongji.showroom.view.titleWindows.FilterTitleWindow;
	import com.tongji.showroom.view.titleWindows.SingleFurnitureTitleWindow;
	
	import flash.display.DisplayObject;
	
	import mx.core.IFlexDisplayObject;
	import mx.managers.PopUpManager;
	
	import org.robotlegs.core.IMediatorMap;

	/**
	 * 
	 * @author chenchao
	 * 
	 */
	public class PopUpAdmin
	{
		public static function popupCenterWindow(type:String, view:DisplayObject, mediatorMap:IMediatorMap, model:Boolean = true, name:String = null):void
		{
			var window:IFlexDisplayObject;
			
			switch (type)
			{
				case "furnitureInfo":
					window = new SingleFurnitureTitleWindow();
					break;
				case "filterWin":
					window = new FilterTitleWindow();
					break;
			}
			
			PopUpManager.addPopUp(window, view, model);
			
			window.x = (int)(view.stage.stageWidth / 2 - window.width / 2);
			window.y = (int)(view.stage.stageHeight / 2 - window.height / 2);
			mediatorMap.createMediator(window);
		}
	}
}